#!/usr/bin/env python3
"""
Hyperliquid Trading Bot based on Hummingbot Framework

This is the main entry point for the Hyperliquid trading bot that uses
the Hummingbot framework for automated trading strategies.
"""

import asyncio
import logging
import sys
from pathlib import Path

# Add project root to Python path
project_root = Path(__file__).parent
sys.path.insert(0, str(project_root))

from config.settings import Config


def setup_logging():
    """Setup logging configuration"""
    logging.basicConfig(
        level=logging.INFO,
        format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
        handlers=[
            logging.FileHandler('hyperliquid_bot.log'),
            logging.StreamHandler(sys.stdout)
        ]
    )


async def main():
    """Main entry point for the Hyperliquid trading bot"""
    setup_logging()
    logger = logging.getLogger(__name__)
    
    try:
        # Load configuration
        config = Config()
        logger.info("Configuration loaded successfully")
        
        logger.info("Starting Hyperliquid Trading Bot...")
        logger.info("Hyperliquid Trading Bot started successfully")
        logger.info("Use run_bot.py to select and run trading strategies")
        
        # Keep the application running
        while True:
            await asyncio.sleep(1)
            
    except KeyboardInterrupt:
        logger.info("Received interrupt signal, shutting down...")
    except Exception as e:
        logger.error(f"Error starting bot: {e}")
    finally:
        logger.info("Hyperliquid Trading Bot stopped")


if __name__ == "__main__":
    asyncio.run(main())